<%@page import="com.shsh.safemanage.model.Department1"%>
<%@page import="com.shsh.safemanage.dao.ProblemDao"%>
<%@page import="com.shsh.safemanage.dao.UserDao"%>
<%@page import="com.shsh.safemanage.util.Util"%>
<%@page import="com.shsh.safemanage.model.Problem"%>
<%@page import="java.util.List"%>
<%@page import="com.shsh.safemanage.model.PostcheckMonthSanweiReport"%>
<%@page import="com.shsh.safemanage.dao.DaoCreator"%>
<%@page import="com.shsh.safemanage.dao.PostCheckDao"%>
<%@page import="com.shsh.safemanage.action.ActionCreator"%>
<%@page import="com.shsh.safemanage.action.PostcheckReportAction"%>
<%@page import="com.shsh.safemanage.model.User"%>
<%@page import="com.shsh.safemanage.util.Constants"%>
<%@page import="com.shsh.safemanage.util.RequestUtil"%>
<%@ page language="java" pageEncoding="UTF-8"%>
<%
{

session.removeAttribute(Constants.SESSION_POSTCHECK_CORP_MONTH_SANWEI_REPORT);

Long problemID = RequestUtil.getParameter(request, Constants.REQUEST_PARAMETER_ID, (Long)null);
Long transferID = RequestUtil.getParameter(request, Constants.REQUEST_PARAMETER_TRANSFER_ID, (Long)null);

User sessionUser = (User)session.getAttribute(Constants.SESSION_USER);

PostcheckReportAction reportAction = ActionCreator.createPostcheckReportAction();

PostCheckDao thePostcheckDao = DaoCreator.createPostCheckDao();
ProblemDao problemDao = DaoCreator.createProblemDao();
UserDao userDao = DaoCreator.createUserDao();

Problem problem = problemDao.getProblemByID(problemID);
PostcheckMonthSanweiReport report = thePostcheckDao.getMonthSanweiReportByProblemID(problemID);

session.setAttribute(Constants.SESSION_POSTCHECK_CORP_MONTH_SANWEI_REPORT, report);

int year = report.getYear();
int month  = report.getMonth();

String fromPage = request.getParameter(Constants.REQUEST_PARAMETER_FROM_PAGE);
if(fromPage == null){
	fromPage = "user_info.jsp";
} else if(fromPage.equals("problemsTobeProcessed")){
	fromPage = "problems_tobe_processed.jsp";
} else if (fromPage.equals("yiban")) {
	fromPage = "problem_browse.jsp";
} else {
	fromPage = "user_info.jsp";
}
%>
<div class="hider" id="hider">
	<span>&nbsp;</span>
</div>
<div class="position">
	<img src="images/position2.jpg" style="padding: 7px 9px; float: left;" />当前位置：上海高桥分公司问题管理平台 &gt;&gt; 岗检汇总统计 &gt;&gt;<%=year %>年<%=month %>月公司岗检“三违”现象问题汇总
</div>
<div class="tt">《<%=year %>年<%=month %>月公司岗检“三违”现象问题汇总》</div>
<div class="content" style="">
	<div style="width:97%;margin-left: 10px;font-weight:bold;font-size:20; ">
	<span style="margin-right: 20px;float:right;">
		月份：<%=report.getYear() %>年<%=report.getMonth() %>月
	</span>
	</div>
	
	<table border="1" width="99%" style="align:center; margin-left: 6px">
		<tr>
		<td style="text-align:center;width:4%;" class="td3">
		序号
		</td>
		<td style="text-align:center;width:10%;" class="td3">
		处室
		</td>
		<td style="text-align:center;width:10%;" class="td3">
		岗检管理线条
		</td>
		<td style="text-align:center;width:10%;" class="td3">
		作业部
		</td>
		<td style="text-align:center;width:10%;" class="td3">
		装置
		</td>
		<td style="text-align:center;width:6%;" class="td3">
		扣分值
		</td>
		<td style="text-align:center;" class="td3">
		扣分原因
		</td>
		<td style="text-align:center;width:12%;" class="td3">
		是否“三违”现象
		</td>
		</tr>
<%
List<Problem> postcheckList = report.getPostcheckList();
for(int i=0;i<postcheckList.size();i++) {
	Problem p = postcheckList.get(i);
%>
		<tr>
			<td style="text-align:center;" >
			<%=i+1 %>
			</td>
			<td style="padding-left:5px;padding-right:5px;text-align:center;">
			<%=Util.getDisplay(p.getWriterDepartment1Name(), "&nbsp;") %>
			</td>
			<td style="padding-left:5px;padding-right:5px;text-align:center;">
			<%=Util.getDisplay(p.getPostcheckName(), "&nbsp;") %>
			</td>
			<td style="padding-left:5px;padding-right:5px;text-align:center;">
			<%=Util.getDisplay(p.getDepartment1Name(), "&nbsp;") %>
			</td>
			<td style="padding-left:5px;padding-right:5px;text-align:center;">
			<%=Util.getDisplay(p.getEquipmentName(), "&nbsp;") %>
			</td>
			<td style="padding-left:5px;padding-right:5px;text-align:center;">
			<%=p.getGrade()==null?"&nbsp;":Util.formatGrade(p.getGrade()) %>
			</td>
			<td style="padding-left:5px;padding-right:5px;text-align:center;">
			<%=Util.getDisplay(p.getProblemContent(), "&nbsp;") %>
			</td>
			<td style="padding-left:5px;padding-right:5px;text-align:center;">
				<input disabled="disabled" id="SanweiTrue<%=p.getId() %>" name="SanweiTrue<%=p.getId() %>" type="checkbox" value="true"  <%=p.getIsSanwei()?"checked=\"checked\"":"" %> onclick="checkSanweiTrue(<%=p.getId() %>)"/><label for="SanweiTrue<%=p.getId() %>">是</label>
				<input disabled="disabled"  id="SanweiFalse<%=p.getId() %>" name="SanweiFalse<%=p.getId() %>" type="checkbox" value="false" <%=!p.getIsSanwei()?"checked=\"checked\"":"" %> onclick="checkSanweiFalse(<%=p.getId() %>)" /><label for="SanweiFalse<%=p.getId() %>">否</label>
			</td>
		</tr>
<%
}
%>
	<tr>
		<td class="td3" colspan="2" style="text-align:center;" >
			汇总人
		</td>
		<td  colspan="2" style="text-align:center;">
		<%=problem.getWriteUserName() %>
		</td>
		<td class="td3" colspan="2" style="text-align:center;" >
			汇总日期
		</td>
		<td style="text-align:center;">
			<%=Util.formatDate(problem.getWriteTime()) %>
		</td>
		<td class="td3" style="text-align:center;" >
			&nbsp;
		</td>
	</tr>

	</table>

<br/>
<br/>
	<table border="1" width="99%" style="align:center; margin-left: 6px">
		<tr>
			<td style="text-align:center;width:10%;" class="td3">
			作业部（业务中心）
			</td>
<%
for(Department1 depart1 : report.getShiyebuList().values()) {
%>
			<td style="text-align:center;width:6%;" class="td3">
			<%=depart1.getDepartmentName() %>
			</td>
<%
}
%>
		</tr>
		<tr>
			<td style="text-align:center;" class="td3">
			被查出“三违”现象次数
			</td>
<%
for(Department1 depart1 : report.getShiyebuList().values()) {
	int isSanweiCount = report.getShiyebuTable().get(depart1.getId());
%>
			<td style="text-align:center;">
			<%=isSanweiCount %>
			</td>
<%
}
%>
		</tr>
	</table>
	
	
<br/>
<br/>
	<table border="1" width="99%" style="align:center; margin-left: 6px">
		<tr>
			<td style="text-align:center;width:10%;" class="td3">
			处室
			</td>
<%
for(Department1 depart1 : report.getChushiList().values()) {
%>
			<td style="text-align:center;width:6%;" class="td3">
			<%=depart1.getDepartmentName() %>
			</td>
<%
}
%>
		</tr>
		<tr>
			<td style="text-align:center;" class="td3">
			被查出“三违”现象次数
			</td>
<%
for(Department1 depart1 : report.getChushiList().values()) {
	int isSanweiCount = report.getChushiTable().get(depart1.getId());
%>
			<td style="text-align:center;">
			<%=isSanweiCount %>
			</td>
<%
}
%>
		</tr>
	</table>
	
	<table border="1" width="99%" style="align:center; margin-left: 6px">
		<tr>
		<td class="td1" height="35" colspan="10" style="padding-top:15px;padding-bottom:15px;">
			<input type="button" style="margin-left: 45%;" value="取 消" onclick="cancelWrite()" />
		</td>
		</tr>
	</table>
</div>

<script type="text/javascript">
function cancelWrite(){
	loadPageSection('<%=request.getContextPath()%>/<%=fromPage%>', 'mainContentDiv');	
}

</script>
<%
}
%>